﻿@{
    Layout = null;
    var stockList = (List<Stock>)ViewBag.stockList;
      var adp = new DbContextAdapter();
    var productService = new ProductService(adp);
}
@using Super.DomainService
@using Super.Infrastructure
@model Product
<div class="pageHeader" style="border: 1px #B8D0D6 solid">
    <div class="panel" defh="100">
        <form id="pagerForm" onsubmit="return divSearch(this, 'jbsxBox_stock');" action="/admin/stock/AddInputList" method="post">
        <h1>库存详情</h1>
            <div class="pageFormContent" id="stockList_Detial">
                @Html.HiddenFor(a=>a.ID)
                <p><label>供应商:</label>
                    @Html.DropDownList("Supplier_ID", (IEnumerable<SelectListItem>)ViewBag.Suppliers, "选择供应商")
                </p>
                @Html.DWZTextBoxFor(a => a.Title, "产品名称").Disable()
                @Html.DWZTextBoxFor(a => a.Model, "产品型号").Disable()
                @Html.DWZTextBoxFor(a => a.CBPrice, "成本价").Required()
                @Html.DWZTextBoxFor(a => a.LSPrice, "零售价").Required()
                @Html.DWZTextBox("Count", "产品数量").Required().Digits()
                <div class="buttonActive">
                    <div class="buttonContent">
                        <button type="submit">添加</button></div>
                </div>
            </div>
        </form>
    </div>
</div>
<div class="pageContent" style="border-left: 1px #B8D0D6 solid; border-right: 1px #B8D0D6 solid">
    <div class="panelBar">
        <ul class="toolBar">
            <li><a class="add" href="/admin/stock/SaveInpuList" target="ajaxTodo" ><span>保存入库单</span></a></li>
        </ul>
    </div>
    <table class="table" width="99%" rel="jbsxBox_stock">
        <thead>
            <tr>
                <th width="120" align="center">名称</th>
                <th width="120" align="center">分类</th>
                <th width="120" align="center">成本价</th>
                <th width="120" align="center">零售价</th>
                <th width="120" align="center">库存数量</th>
                <th width="120" align="center">创建时间</th>
            </tr>
        </thead>
        <tbody>
            @{
                if (stockList != null)
                {
                    foreach (var item in stockList)
                    {
                        var productModel = productService.Repository.Find(a => a.ID == item.Product_ID).FirstOrDefault();
                <tr target="sid_user" rel="@item.ID">
                    <td align="center">@productModel.Title</td>
                    <td align="center">@productModel.ProductCategory.Name</td>
                    <td align="center">@item.CBPrice</td>
                    <td align="center">@item.LSPrice</td>
                    <td align="center">@item.Count</td>
                    <td align="center">@item.CreateTime.ToShortDateString()</td>
                   
                </tr>
    
                    }
                }
            }
        </tbody>
    </table>
</div>
<style type="text/css">
    #stockList_Detial p { width: 300px; }
    .gridScroller { height: 400px; }
</style>
